< previous page page_387 next page >

Page 387
The GeneralFile class is purely an interface class, meaning that its methods and properties are to be implemented by other classes that subscribe to its interface via the Implements keyword. It is implemented by the RandomFile, SequentialFile, BinaryFile, and RichTextFile classes. The RandomFile class encapsulates file operations related to random access files. The SequentialFile class encapsulates file operations related to sequential access files. The BinaryFile class encapsulates file operations related to binary access files. The RichTextFile class encapsulates file operations related to Rich Text Box files. The RichTextFile class also includes methods for working with the Rich Text Box. If your implementation of this class becomes complex, you might consider creating helper classes that specialize in selecting a range of text and printing the contends of the file.
Methods
GeneralFile family of classes each support the following methods:
openFile
closeFile
persistNewInfo
persistAddedInfo
The openFile and closeFile methods are self-explanatory. However, each file class implements them differently. That is, the RandomFile class opens a file for random access, a SequentialFile class for sequential access, and a BinaryFile class for binary access. The RichTextFile class simply loads a file into the Rich Text Box and assigns the Contents property of the RichTextFile class to the value of the Text property. The persistNewInfo saves information to a file that did not exist before, while the persistAddedInfo adds information to a previously existing file. For SequentialFile objects, the file would have to be opened in Append mode.
The notable methods of the IFileSubsystem class are
copyFile
deleteFile
transferToFile
The copyFile method uses Visual Basic's FileCopy statement to copy a file from one place to another. The deleteFile method uses Visual Basic's Kill statement to delete a file from disk. The transferToFile method takes the records in a Remote Data Object (RDO) Resultset and persists them to a file.

 
< previous page page_387 next page >

If you like this book, buy it!